package com.mzba.zxdlyllp.utils;

import java.io.File;
import java.lang.ref.WeakReference;

import android.content.Context;
import android.os.Environment;

/**
 * 全局类
 * 
 * @author 06peng
 * 
 */
public class AppContext {


	private static AppContext instance = new AppContext();

	public static AppContext getInstance() {
		if (instance == null) {
			instance = new AppContext();
		}
		return instance;
	}

	/**
	 * 获取 系统上下文
	 */
	private WeakReference<Context> context;

	/**
	 * 获取 系统上下文
	 * 
	 * @return
	 */
	public static Context getContext() {
		if (getInstance().context == null) {
			return null;
		}
		return getInstance().context.get();
	}

	/**
	 * 设置 系统上下文
	 * 
	 * @return
	 */
	public static void setContext(Context contextx) {
		getInstance().context = null;
		getInstance().context = new WeakReference<Context>(contextx);
	}
	
	/** 取SD卡路径 **/
    public static String getSDPath() {
        File sdDir = null;
        boolean sdCardExist = Environment.getExternalStorageState().equals(
                android.os.Environment.MEDIA_MOUNTED);  //判断sd卡是否存在
        if (sdCardExist) {
            sdDir = Environment.getExternalStorageDirectory();  //获取根目录
        }
        if (sdDir != null) {
            return sdDir.toString() + "/genderhealth";
        } else {
            return "";
        }
    } 
	
	private String authToken;

	public String getAuthToken() {
		return authToken;
	}

	public void setAuthToken(String authToken) {
		this.authToken = authToken;
	}
	
	public static final String NOTIfACATION_RECEIVE = "notifactaion_receive";
	
	public static final String load_images_url = "http://06peng.com/project_images/load_images.php";
	public static final String load_books_url = "http://06peng.com/project_books/load_books.php";
	public static final String load_love_url = "http://06peng.com/project_love/load.php";
	public static final String load_masturbation_url = "http://06peng.com/project_masturbation/load.php";
	public static final String load_sextips_url = "http://06peng.com/project_sextips/load.php";
	public static final String load_sexuality_url = "http://06peng.com/project_sexuality/load.php";
	
	public static final String image_cache_path = "imageCache";
	
	public static final String WHOLESALE_CONV = ".cach";
}
